﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index1.aspx.cs" Inherits="Thksoft.Module.ApplyView.Apply.Index1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>月资金计划申请</title>
    <link href="/UserCotrols/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
    <script src="/UserCotrols/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-1.7.min.js" type="text/javascript"></script>
    <style type="text/css">
        #mydiv1 {
            border: 2px solid #2894FF;
            border-radius: 15px;
            -moz-border-radius: 15px;
            background-color: #F0F0F0;
        }

        #mytable1 tr {
            height: 40px;
            line-height: 40px;
        }

        #mytable1 .jjzj_jjzj_righttd input {
            border: 1px soild blue;
        }

        #mytable1 tr td input, textarea {
            font-size: 12px;
            margin: 0;
            padding: 0;
            border: 1px solid #BAD4E1;
            text-indent: 8px;
            height: 20px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <%
        var user = User1;
        var company = new BLL.Sys_CompanyBLL().Find(user.USER_COMPANY);
        var CompanyName = company.CMY_NAME;
        var key = Guid.NewGuid();
        //查询部门领导
        var userIdStr = new BLL.Sys_UserBLL().GetUserIdByCompanyId((int)company.CMY_ID);
    %>
    <div id="<%=key %>" style="margin: 0 auto; padding: 30px; width: 740px;">
    <p style="text-align: center; font-weight: bold; font-size: medium; color:#2894FF" >月资金计划申请</p><br />
    <div id="mydiv1" style="width: 100%; text-align: center; padding-top: 20px;">
        <input id="<%=key %>_CompanyId" type="hidden" value="<%=company.CMY_ID %>" />
        <input id="<%=key %>_BzId" type="hidden" value="<%=userIdStr %>" />
        <table id="mytable1" border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td class="jjzj_lefttd">
                    <img src="/App_Themes/MSN_Blue/Images/jjzj_gs.png" style="vertical-align:middle" />&nbsp;&nbsp;公&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;司：
                </td>
                <td class="jjzj_righttd">
                    <label><%=CompanyName %></label>
                </td>
                <td class="jjzj_lefttd">
                    <img src="/App_Themes/MSN_Blue/Images/jjzj_rq.png" style="vertical-align:middle" />&nbsp;&nbsp;日&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;期：
                </td>
                <td class="jjzj_righttd">
                    <input id="<%=key %>_ApplyDate")" placeholder="请选择日期" value="<%=DateTime.Now.ToString("yyyy-MM") %>" class="Wdate INPUT DATE" type="text" onclick=" WdatePicker({dateFmt:'yyyy-MM'})" />
                    <span style="color: Red;">*</span>
                </td>
            </tr>
            <tr>
                <td class="jjzj_lefttd">
                    <img src="/App_Themes/MSN_Blue/Images/jjzj_yw.png" style="vertical-align:middle" />&nbsp;&nbsp;编制依据及事由：
                </td>
                <td class="jjzj_righttd" colspan="3">
                    <input id="<%=key %>_Title")" placeholder="请输入编制依据及事由" value="<%=DateTime.Now.ToString("yyyy年M月") %><%=CompanyName %>资金计划" class="INPUT MAX" style="width:52.5%;" />
                    <span style="color: Red;">*</span>
                </td>
            </tr>
            <tr>
                <td class="jjzj_lefttd">
                    <img src="/App_Themes/MSN_Blue/Images/jjzj_zh.png" style="vertical-align:middle" />&nbsp;&nbsp;编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;制&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;人：
                </td>
                <td class="jjzj_righttd" colspan="3">
                    <input id="<%=key %>_BzStr")" placeholder="请点选编制人" value="<%=CompanyName %> - 所有部门" class="INPUT" style="width:52.5%;" />
                    <span style="color: Red;">*</span>
                </td>
            </tr>
            <tr>
                <td class="jjzj_lefttd">
                    <img src="/App_Themes/MSN_Blue/Images/jjzj_bz.png" style="vertical-align:middle" />&nbsp;&nbsp;备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：
                </td>
                <td colspan="3" class="jjzj_righttd">
                    <textarea id="<%=key %>_Remark")" class="INPUT" style="margin-top: 10px;width:95%;height:60px;"></textarea>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;" colspan="4">
                    <button id="<%=key %>_Save")" class="bt_css_s" type="button">申请</button>
                </td>
            </tr>
        </table>
    </div>
</div>
<script type="text/javascript">
    $("#<%=key %>_ApplyDate").change(function (event) {
        //验证日期是否有效。
    });
    $("#<%=key %>_Save").click(function () {
        var titileId = "<%=key %>_Title";
        var bzId = "<%=key %>_BzId";
        if ($("#" + titileId).val().trim() == "") {
            alert("编制依据及事由不能为空");
            return;
        }
        if ($("#" + bzId).val().trim() == "") {
            alert("请选择编制人");
            return;
        }
        if ($("#<%=key %>_ApplyDate").val().trim() == "") {
            alert("请选择资金申请周期");
            return;
        }
        var data = {};
        data.Type = "Month";
        data.Title = $("#" + titileId).val();
        data.BzId = $("#" + bzId).val();
        data.CompanyId = parseInt($("#<%=key %>_CompanyId").val());
        data.Date = $("#<%=key %>_ApplyDate").val();
        $.ajax({
            async: false,
            type: "POST",
            url: "/Module/ApplyView/ApplyHandler.ashx?MethodType=SubmitApplay",
            data: JSON.stringify(data),
            success: function (result) {
                if (result.Type == 1) {
                    alert("申请成功");
                    return;
                }
                alert(result.Msg);
                return;
            },
            erro: function () {
                alert("网络或者服务异常");
                return;
            }
        });
    });
    </script>
    </form>
</body>
</html>